var get = function () {
    $.ajax({
        url: webPath + "/index/db/get",
        type: 'post',
        dataType: 'json',
        success: function (data) {
            $("#area").val("");
            for (var i = 0;i<data.length;i++){
                $("#area").val("ID:" + data[i].ID + "  name:" + data[i].NAME);
            }
        }
    });
}

var del = function () {
    var id = prompt("请输入要删除的ID", "");
    if (id) {
        $.ajax({
            url: webPath + "/index/db/del",
            type: 'post',
            data: {id: id},
            dataType: 'json',
            success: function (data) {
                if (data.status > 0) {
                    alert("成功");
                }
            }
        });
    }
}
var update = function () {
    var name = prompt("请输入name", "");
    if (name) {
        var id = prompt("请输入要修改的ID", "");
        if (id) {
            $.ajax({
                url: webPath + "/index/db/update",
                type: 'post',
                data: {id: id, name: name},
                dataType: 'json',
                success: function (data) {
                    if (data.status > 0) {
                        alert("成功");
                    }
                }
            });
        }
    }
}
var insert = function () {
    var name = prompt("请输入name", "");
    if (name) {
        $.ajax({
            url: webPath + "/index/db/insert",
            type: 'post',
            data: {name: name},
            dataType: 'json',
            success: function (data) {
                if (data.status > 0) {
                    alert("成功");
                }
            }
        });
    }
}
